package com.bifrost.model;

import com.bifrost.constant.InventoryType;
import com.bifrost.constant.OrderItemType;
import com.bifrost.constant.PricingModel;
import com.bifrost.constant.ShippingType;
import com.bifrost.model.option.OptionModel;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.Future;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * @author 里昂
 * @com.bifrost.model
 * @wechat-mall
 * @lee Create Class on 2018/4/4
 */
@ApiModel("Product基本商品信息")
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ProductBasicModel implements Serializable{


        private Long productId;

        @ApiModelProperty(name = "canPreorder" , value = "是否可预订 default:false")
        private Boolean canPreorder = Boolean.FALSE;

        @NotNull(message = "分类编码不能为空")
        private String externalCcategory;

        @ApiModelProperty(name = "featuredProduct" , value = "是否热销商品 default:false")  //
        private Boolean featuredProduct = Boolean.FALSE;

       /* @ApiModelProperty(name = "merchantId" , value = "门店id")  //
        private Long merchantId = 1L;*/

        @ApiModelProperty(name = "productManufacturer" , value = "制造商")
        private String productManufacturer;

        @ApiModelProperty(name = "productName" , value = "商品名称")
        @NotNull(message = "商品名称不能为空")
        private String productName;

        @ApiModelProperty(name = "productVirtual" , value = "是否虚拟商品 :default:false" )
        private Boolean productVirtual = Boolean.FALSE;

        @ApiModelProperty(name = "sortOrder" , value = "商品排序号")
        private int sortOrder =1;
        private String externalId;

        @ApiModelProperty(name = "brandId" , value = "商品品牌")
        @NotNull(message = "商品品牌不能为空")
        private Long brandId;

        @ApiModelProperty(name = "categoryId" , value = "商品分类")
        @NotNull(message = "商品分类不能为空")
        private Long categoryId;

        @ApiModelProperty(name = "skuShipmentId" , value = "sku运费模板Id")
        private Long skuShipmentId;

        @ApiModelProperty(name = "mediaModels" ,value = "defaultSku的图片[]")
        private List<MediaModel> mediaModels;


        /** sku公用信息*/
        @NotNull(message = "商品有效日期不能为空")
        /** 序列化 格式化时间*/
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
        private Date activeStartDate;
        @NotNull(message = "商品过期日期不能为空")
        @Future(message = "商品过期日期必须在当前日期之后")
        /** 序列化 时间格式*/
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
        private Date activeEndDate;
        private Boolean canAddCart = Boolean.TRUE;

        @ApiModelProperty(name = "fulfillmentType" , value =    "<p> 快递类型默认:既可快递又可到店" +
                                                                "SELF_DELIVERY :  门店自提</br>"+
                                                                "DELIVERY :  快递</br>"+
                                                                "BOTH :  快递或门店自提</br>"+
                                                                "</p>")
        private String fulfillmentType = ShippingType.BOTH;
        @ApiModelProperty(name = "fulfillmentType" , value =    "<p> 库存类型默认:总是可用的" +
                                                                "ALWAYS_AVAILABLE :     总是可用</br>"+
                                                                "UNAVAILABLE :          不可用</br>"+
                                                                "CHECK_QUANTITY :       需要检查数量</br>"+
                                                                "</p>")
        private String inventoryType = InventoryType.CHECK_QUANTITY;
        @ApiModelProperty(name = "discountable" , value = "可折扣  default:true")
        private Boolean discountable = Boolean.TRUE;
        @ApiModelProperty(name = "preorderDays" , value = "预订有效时间 default:0")
        private Integer preorderDays = 0;
        @ApiModelProperty(name = "guaranteesDays" , value = "质保期 default:0")
        private Integer guaranteesDays = 0;   //多少天 不能质保

        @ApiModelProperty(name = "itemType" , value = "商品类型: {BASIC:基础商品.BUNDLE:绑定商品.GIFTWRAP:赠品.DIGITAL:数码商品.SERVICE:服务.}")
        private String itemType = OrderItemType.BASIC;

        /** 是否可促销*/
        @ApiModelProperty(name = "promotable" , value = "是否可促销 default:true")
        private Boolean promotable = Boolean.TRUE;
        @ApiModelProperty(name = "weightUnitOfMeasure" , value = "重量计量单位")
        private String weightUnitOfMeasure;
        @ApiModelProperty(name = "originPlace" , value = "生产地  default:详见商品")
        private String originPlace;
        private String unit;
        private String longDescription;
        @ApiModelProperty(name = "pricingModel" , value = "商品类型：组合商品 ， 商品项")
        private String pricingModel = PricingModel.ITEM_SUM;

        @ApiModelProperty(name = "models" , value = "用于前端拼接规格参数")
        private List<OptionModel> models;

        /**DefaultSku*/
        private Long skuId;
        @ApiModelProperty(name = "retailPrice" , value = "defaultSku零售价")
        private BigDecimal retailPrice;
        @ApiModelProperty(name = "retailPrice" , value = "defaultSku是否可用")
        private Boolean defaultAvaiable = Boolean.TRUE;
        @ApiModelProperty(name = "salePrice" , value = "defaultSku销售价")
        private BigDecimal salePrice;
        @ApiModelProperty(name = "skuCost" , value = "defaultSku成本价")
        private BigDecimal skuCost;
        @ApiModelProperty(name = "quantityAvailable" , value = "defaultSku库存")
        protected Integer quantityAvailable = 0;
        @ApiModelProperty(name = "skuCode" , value = "defaultSkuCode")
        private String skuCode;
        @ApiModelProperty(name = "com/bifrost/excel/model", value = "defaultSku规格描述")
        private String model;
        @ApiModelProperty(name = "skuUpc" , value = "defaultSku条形码")
        private String skuUpc;
        @ApiModelProperty(name = "bonusPointsRate" , value = "defaultSku积分率")
        private Integer bonusPointsRate;


         /*@ApiModelProperty(name = "productType" , value = "商品类型")
        private String productType;*/

        /**
         *
         *
         *  `META_DESC` varchar(255) DEFAULT NULL,
         `META_TITLE` varchar(255) DEFAULT NULL,
         *
         */
        //积分率 分类.product.sku.
}
